# Contributor: omni <omni+alpine@hack.org>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=kmon
pkgver=1.6.5
pkgrel=0
pkgdesc="Linux Kernel Manager and Activity Monitor"
arch="all !s390x !riscv64" # limited by cargo
url="https://kmon.cli.rs/"
license="GPL-3.0-or-later"
depends="kmod util-linux-misc" # dmesg
makedepends="cargo python3 libxcb-dev cargo-auditable"
subpackages="$pkgname-doc
	$pkgname-bash-completion $pkgname-fish-completion $pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/orhun/kmon/archive/refs/tags/v$pkgver.tar.gz"


prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm0755 target/release/kmon -t "$pkgdir"/usr/bin
	install -Dm0644 target/man/kmon.8 "$pkgdir"/usr/share/man/man8/kmon.8
	install -Dm0644 target/completions/kmon.bash \
		"$pkgdir"/usr/share/bash-completion/completions/kmon
	install -Dm0644 target/completions/kmon.fish \
		-t "$pkgdir"/usr/share/fish/vendor_completions.d
	install -Dm0644 target/completions/_kmon \
		-t "$pkgdir"/usr/share/zsh/site-functions
}

sha512sums="
d5ed6277595b51cc1a42db52065f88c734ffb4e65e8832cd7c59904e221cdb8e1f3c1129020e1a5b8ef0900a53503a80f52a5d78b85adea25b952b4dff958520  kmon-1.6.5.tar.gz
"
